package reflect;
import java.lang.reflect.Method;
public class ReflectDemo5 {
    public static void main(String[] args) throws Exception
    {
        //p.say(String);
        Class c = Class.forName("reflect.Person");
        Object obj = c.newInstance();///创建对象

        Method m = c.getMethod("say",String.class);
        m.invoke(obj,"hello");

        //obj.say("嘿嘿",5);
        Method m2 = c.getMethod("say",String.class,int.class);
        m2.invoke(obj,"嘿嘿",5);
    }
}
